package com.lsa.letcode.the35.searchInsertPos;

import org.junit.Assert;
import org.junit.Test;

public class SearchInsertPosTest {
	@Test
	public void test() {
		Solution s = new Solution();
		test(s, new int[] { 1, 3, 5, 6 }, 5, 2);
		test(s, new int[] { 1, 3, 5, 6 }, 0, 0);
		test(s, new int[] { 10, 30, 50, 60 }, 31, 2);
		test(s, new int[] { 10, 30, 50, 60 }, 55, 3);
		test(s, new int[] { }, 55, 0);
		test(s, new int[] { 1,2 }, 3, 2);
		test(s, new int[] { 1 }, 2, 1);
	}

	private void test(Solution s, int[] arr, int e, int expected) {
		Assert.assertEquals(expected, s.searchInsert(arr, e));
	}
}
